package com.linln.modules.member.domain;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Entity;
import javax.persistence.EntityListeners;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Transient;

import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;
import org.hibernate.annotations.Where;
import org.springframework.data.annotation.CreatedBy;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.linln.common.enums.DayEnum;
import com.linln.common.enums.StatusEnum;
import com.linln.common.utils.StatusUtil;
import com.linln.modules.system.domain.User;

import lombok.Data;

/**
 * @author hct
 * @date 2019/09/12
 */
@Data
@Entity
@Table(name="member_agent")
@EntityListeners(AuditingEntityListener.class)
//@Where(clause = StatusUtil.NOT_DELETE)
public class MemberAgent implements Serializable {
    // 主键ID
    @Id
    @GeneratedValue(strategy=GenerationType.IDENTITY)
    private Long id;
    // 用户id
    //private Long memberId;
    @ManyToOne(fetch=FetchType.LAZY)
    @NotFound(action=NotFoundAction.IGNORE)
    @JoinColumn(name="member_id")
    private MemberInfo member;
   
    private String area;
    //冗余区域名字，方便使用
    private String areaname;
    //总收入
    private Double allmoney;
    //当前余额
    private Double curmoney;
    private String orderId;
    
    private Integer payStatus;
    
    //暂时记录一下，用户支付500元
    private Double agentMoney;
    
    //操作管理员
    private Long managerId;//
    
    // 创建时间
    @CreatedDate
    private Date createDate;
    // 更新时间
    @LastModifiedDate
    private Date updateDate;
    // 操作人
    @CreatedBy
    @ManyToOne(fetch=FetchType.LAZY)
    @NotFound(action=NotFoundAction.IGNORE)
    @JoinColumn(name="create_by")
    @JsonIgnore
    private User createBy;
    // 状态
    private Byte status = StatusEnum.OK.getCode();
    
}